//
//  ALPListenListMoreCell.m
//  AlpFM
//
//  Created by dllo on 16/2/26.
//  Copyright © 2016年 Alp. All rights reserved.
//

#import "ALPListenListMoreCell.h"
#import "ALPListenListMoreCellSmall.h"
#import "ALPListenListMoreModel.h"

@interface ALPListenListMoreCell ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong) UIImageView *sanjiao; //三角图标
@property (nonatomic, strong) UITableView *myTableView;
@property (nonatomic, strong)UILabel *title;

@end

@implementation ALPListenListMoreCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}
-(void)creatCell{
    
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(35, 9, 200, 20)];
    self.title.font = [UIFont boldSystemFontOfSize:16];
    self.title.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.title];
    
    self.sanjiao = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 16, 16)];
    self.sanjiao.image = [UIImage imageNamed:@"sanjiao"];
    [self.contentView addSubview:self.sanjiao];
    
    self.myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 40, 375, 78) style:UITableViewStylePlain];


    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    self.myTableView.showsVerticalScrollIndicator = NO; //取消滚动条
    self.myTableView.scrollEnabled = NO;    //禁止滚动
    self.myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLineEtched;
    [self.contentView addSubview:self.myTableView];
    self.myTableView.backgroundColor = [UIColor blueColor];
    [self.myTableView registerClass:[ALPListenListMoreCellSmall class] forCellReuseIdentifier:@"cell"];

}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 78;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _array.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ALPListenListMoreCellSmall *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    ALPListenListMoreModel *mol = [_array objectAtIndex:indexPath.row];
    cell.mol = mol;
    
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
     [tableView deselectRowAtIndexPath:indexPath animated:NO];  //取消选中状态
    ALPListenListMoreModel *mol = [_array objectAtIndex:indexPath.row];
    [self.xieyiren pushDetailVC:mol.specialId contentType:mol.contentType indexPath:indexPath.row + 1];
}

-(void)setArray:(NSMutableArray *)array{
    _array = array;
    self.myTableView.frame = CGRectMake(0, 40, 375, 78 * _array.count);
    [self.myTableView reloadData];
}

//时间标题
-(void)setTitleStr:(NSString *)titleStr{
    self.title.text = titleStr;
}










@end
